package com.kosam.commons.base.service;

import com.kosam.commons.base.repository.RepositorySupport;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

import java.io.Serializable;
import java.util.List;

/**
 * Created by tgx on 2017/2/17.
 */
public interface ServiceSupport<M, ID extends Serializable> {
    void setRepositorySupport(RepositorySupport<M, ID> var1);

    M save(M m);

    M saveAndFlush(M m);

    void delete(ID id);

    void delete(M m);

    void delete(List<ID> ids);

    M findOne(ID id);

    boolean exists(ID id);

    long count();

    List<M> findAll();

    List<M> findAll(Sort sort);

    Page<M> findAll(Pageable pageable);
}
